﻿using System;
namespace Producers.Arireg.Xtee.Riik.Ee.Producer.Arireg {
    
    
    public class XKandeliik : global::Xtee.Core.Schema.XsdString {
        
        public const string ESMAKANNE = "E";
        
        public const string MUUTMISKANNE = "M";
        
        public const string KUSTUTUSKANNE = "K";
        
        public const string ÜHINEMISKANNE = "Y";
        
        public const string KOMMERTSPANDIKANNEAVAMINE = "PA";
        
        public const string KOMMERTSPANDIKANNEKUSTUTAMINE = "PK";
        
        public const string KOMMERTSPANDIKANNEMUUTMINE = "PM";
        
        public const string JAGUNEMISKANNE = "J";
        
        public const string PARANDUSKANNE = "P";
        
        public XKandeliik(string value) : 
                base(value) {
            this.Validate();
            string annot = null;
            if (Value == "E") {
                annot = "Esmakanne";
            }
            if (Value == "M") {
                annot = "Muutmiskanne";
            }
            if (Value == "K") {
                annot = "Kustutuskanne";
            }
            if (Value == "Y") {
                annot = "Ühinemiskanne";
            }
            if (Value == "PA") {
                annot = "Kommertspandikanne (avamine)";
            }
            if (Value == "PK") {
                annot = "Kommertspandikanne (kustutamine)";
            }
            if (Value == "PM") {
                annot = "Kommertspandikanne (muutmine)";
            }
            if (Value == "J") {
                annot = "Jagunemiskanne";
            }
            if (Value == "P") {
                annot = "Paranduskanne";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public XKandeliik() : 
                base(string.Empty) {
        }
        
        public static bool TryParse(string value, out global::Producers.Arireg.Xtee.Riik.Ee.Producer.Arireg.XKandeliik result) {
            try {
                result = new global::Producers.Arireg.Xtee.Riik.Ee.Producer.Arireg.XKandeliik(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator String (XKandeliik value) {
            return value.Value;
        }
        
        public static implicit operator XKandeliik (string value) {
            if (value==null) {
                return null;
            }
            return new XKandeliik(value);
        }
    }
}
